﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.IO;

namespace AmorCanino.Web.Controllers
{
    public class BaseController : Controller
    {
        protected void CheckForPicture(List<Models.Models.Pet> pets)
        {
            var picturePath = Server.MapPath(AmorCanino.Common.ConfigurationHandler.GetPuctirePath);

            foreach (var pet in pets)
            {
                var path = Path.Combine(picturePath, pet.PetId.ToString() + ".jpg");
                if (System.IO.File.Exists(path))
                    pet.HasPicture = true;
            }
        }

        protected void CheckForPicture(Models.Models.Pet pet)
        {
            var picturePath = Server.MapPath(AmorCanino.Common.ConfigurationHandler.GetPuctirePath);
            var path = Path.Combine(picturePath, pet.PetId.ToString() + ".jpg");
            if (System.IO.File.Exists(path))
                pet.HasPicture = true;
        }
    }
}